<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        const canvas = document.createElement('canvas')
        canvas.width = 600
        canvas.height = 600
        document.body.appendChild(canvas)
        const ctx = canvas.getContext('2d')
        
        ctx.beginPath()
        ctx.arc(200,200,100,0,Math.PI * 2)
        ctx.moveTo(290,200); //这行是干什么的
        ctx.arc(200,200,90,0,Math.PI * 2)
        ctx.moveTo(200,200)
        ctx.lineTo(200,130)
        ctx.moveTo(200,200)
        ctx.lineTo(140,200)
        ctx.stroke()

        ctx.font = '12px bold'
        ctx.textAlign = 'center'
        ctx.textBaseline = 'middle'
        ctx.fillText(12,200,120)


        ctx.textAlign = 'left'
        console.log(ctx.measureText("Hello world!").width); // 可以测量一行文字的宽度, 即使没有渲染
        


        
         
    </script>
</body>
</html>